from flask import Flask
import redis
from flask_sqlalchemy import SQLAlchemy
from flask_session import Session
from flask_wtf.csrf import CSRFProtect
from config import Config

# 配置数据库
db = SQLAlchemy()
# 配置redis
redis_store = None

def create_app(config_name):
    app = Flask(__name__)

    # 配置
    app.config.from_object(Config[config_name])

    # 开启CSRF保护
    CSRFProtect(app)
    # 配置session
    Session(app)

